<template>
	<view>
		<u-navbar height="50" back-icon-color="#333" title="解绑银行卡" title-color="#333" title-size="36"></u-navbar>
		<view class="content">
			<view class="cardView" v-if="bankInfo">
				<view class="cardTextView">
					<view class="cardTitle">{{bankInfo.bank}}</view>
					<view class="cardStaus">{{bankInfo.cardholder}}</view>
					<view class="cardText">{{bankInfo.bank_card_number}}</view>
				</view>
			</view>
		</view>
		<view class="unband" @click="onUnBand">解绑卡号</view>
	</view>
</template>

<script>
	import { closeload, toastC, toastload } from '../../utils/common';
import {unCard} from '@/api/user.js'
	export default {
		data() {
			return {
				bankInfo: '',
				bankId: '',
			}
		},
		onLoad(res) {
			this.bankInfo = JSON.parse(res.item);
			this.bankId = this.bankInfo.id;
		},
		methods: {
			onClose() {
				uni.navigateBack({
					delta: 1
				});
			},
			onUnBand() {
				let self = this
				toastload()
				unCard({
					bank_card_id: this.bankId
				}, true).then(res => {
					closeload()
					uni.navigateBack({
						delta: 1
					});
					setTimeout(function() {
						toastC('解绑成功');
					}, 500);
				});
			},
		}
	}
</script>

<style>
	.navTitle {
		flex: 1;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 36rpx;
		color: #333333;
	}

	.closeIcon {
		width: 36rpx;
		height: 36rpx;
		padding: 10rpx;
	}

	.content {
		display: flex;
		flex-direction: column;
	}

	.cardView {
		display: flex;
		flex-direction: row;
		margin-top: 30rpx;
		margin-bottom: 30rpx;
		margin-left: 30rpx;
		margin-right: 30rpx;
		position: relative;
		height: 240rpx;
		background: linear-gradient(0deg, #248CFA, #33C9FF);
		border-radius: 10rpx;
	}

	.cardBg {
		width: 100%;
		height: 240rpx;
	}

	.cardBg2 {
		width: 100%;
		height: 230rpx;
		background: cornflowerblue;
		border-radius: 10rpx;
	}

	.cardDataView {
		display: flex;
		flex-direction: row;
	}

	.cardIcon {
		width: 80rpx;
		height: 80rpx;
		margin-top: 40rpx;
		margin-left: 20rpx;
	}

	.cardTextView {
		display: flex;
		flex-direction: column;
		z-index: 10;
		margin-top: 40rpx;
		margin-left: 20rpx;
	}

	.cardTitle {
		font-size: 30rpx;
		color: #FFFFFF;
	}

	.cardStaus {
		font-size: 30rpx;
		color: #FFFFFF;
		margin-top: 20rpx;
	}

	.cardText {
		font-size: 36rpx;
		color: #FFFFFF;
		margin-top: 20rpx;
	}

	.unband {
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: center;
		font-size: 30rpx;
		color: #333;
		background: #D6D6D6;
		border-radius: 10rpx;
		margin-left: 30rpx;
		margin-right: 30rpx;
		padding-top: 20rpx;
		padding-bottom: 20rpx;
		margin-top: 100rpx;
	}
</style>
